<!DOCTYPE html>
<html>
<head>
    <title>计算1到100的和</title>
    <script>
        window.onload = aaa;

        function aaa(){
            var result = document.getElementById("result");
            var i = 1;
            
            function calculate() {
                result.innerHTML = "当前计算的值：" + i;
                i++;
                
                if (i <= 100) {
                    setTimeout(calculate, 10); // 延迟10毫秒执行下一次循环
                }
            }
            
            calculate();
        }
    </script>
</head>
<body>
    <h1>计算1到100的和</h1>
    <div id="result"></div>
</body>
</html>
